import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'app_colors.dart';

class AppStyleThemeData {
  static ThemeData CustomThemeLight = ThemeData(
    primaryColor: AppColors.app_base_bgcolor_color,
    scaffoldBackgroundColor: AppColors.scaffold_background_color,
    // 可以覆盖更多的ThemeData属性来自定义你的主题
    appBarTheme: AppBarTheme(
        titleTextStyle: TextStyle(color: AppColors.hex1E1E1E,
            fontSize: 36.sp),
        backgroundColor: AppColors.device_page_bg_color
    ),
    bottomNavigationBarTheme: BottomNavigationBarThemeData(
        selectedIconTheme: IconThemeData(
            size: 38.w
        ),
        unselectedIconTheme: IconThemeData(
            size: 25.w
        ),
        selectedLabelStyle:  TextStyle(
            fontSize: 12.sp
        ),
        unselectedLabelStyle: TextStyle(
            fontSize: 12.sp
        )

    ),
    // 文本框的样式.
    inputDecorationTheme: InputDecorationTheme(
      border: InputBorder.none,
      focusedBorder: OutlineInputBorder (
          borderRadius: BorderRadius.circular(45.0),
          borderSide:BorderSide(color: Colors.blue)
      ),
      focusColor: AppColors.app_base_theme_color,
      /* border: OutlineInputBorder (
          borderRadius: BorderRadius.circular(15.0),
          borderSide:BorderSide(color: AppColors.editFieldborder_color)
      ),
      focusedBorder: OutlineInputBorder (
          borderRadius: BorderRadius.circular(15.0),
          borderSide:BorderSide(color: AppColors.editFieldborder_color)
      ),
      enabledBorder: OutlineInputBorder (
          borderRadius: BorderRadius.circular(15.0),
          borderSide:BorderSide(color: AppColors.editFieldborder_color)
      ),*/
      hintStyle: TextStyle(color: AppColors.newEditFieldHintText_color,fontSize: 30.sp,),
      helperStyle: TextStyle(color: AppColors.editFieldText_color,fontSize: 30.sp),
      labelStyle: TextStyle(color: AppColors.editFieldText_color,fontSize: 30.sp),
      contentPadding: EdgeInsets.only(left: 41.w,top:24.h,bottom:24.h, right: 30.w),
    ),
    //
    elevatedButtonTheme: ElevatedButtonThemeData(
        style: ButtonStyle(
            backgroundColor: WidgetStateProperty.resolveWith<Color>((Set<WidgetState> states) {
              if (states.contains(WidgetState.pressed)) {
                return AppColors.appElevateBtnBgColor.withOpacity(0.7); // 按下时的背景色
              } else if (states.contains(WidgetState.disabled)) {
                return AppColors.disable_btn_bg_color;
              } else {
                return AppColors.appElevateBtnBgColor; // 默认背景色
              }

            }),
            foregroundColor: WidgetStateProperty.resolveWith<Color>((Set<WidgetState> states) {
              if (states.contains(WidgetState.disabled)) {
                return Colors.white;
              }
              return Colors.white;
            }),
            shape: WidgetStateProperty.all<OutlinedBorder>(
              RoundedRectangleBorder(
                borderRadius: BorderRadius.circular(4.0), // 圆角大小
              ),
            ),
            padding: WidgetStateProperty.all<EdgeInsetsGeometry>(
              EdgeInsets.symmetric(vertical: 15.0, horizontal: 25.0), // 内边距
            ),
            overlayColor: WidgetStateProperty.resolveWith<Color?>(
                  (Set<WidgetState> states) {
                if (states.contains(WidgetState.hovered)) {
                  return Colors.green.withOpacity(0.1); // 悬停时的叠加色
                }
                return null; // 默认无叠加色
              },
            ),
            textStyle: WidgetStateProperty.resolveWith<TextStyle>(
                  (Set<WidgetState> states) {
                return TextStyle(fontSize: 16.sp,fontWeight: FontWeight.bold,color: Colors.white);
              },
            )
        )
    ),
    primaryTextTheme: TextTheme(
        titleMedium: TextStyle(fontWeight: FontWeight.w400,fontSize: 40.sp)
    ),
    textTheme: TextTheme(
      titleMedium: TextStyle(fontWeight: FontWeight.w400,fontSize: 40.sp),
      titleSmall: TextStyle(fontWeight: FontWeight.w400,fontSize: 28.sp),
      labelMedium: TextStyle(fontSize: 30.sp,color: AppColors.app_base_bgcolor_color),
      labelSmall: TextStyle( color: AppColors.labelText_color,fontSize: 24.sp),
    ),
    switchTheme: SwitchThemeData(
        thumbColor: WidgetStateProperty.all<Color>(Colors.white),
        materialTapTargetSize: MaterialTapTargetSize.shrinkWrap
    ),
    textSelectionTheme: TextSelectionThemeData(
      cursorColor: AppColors.app_base_theme_color,
      selectionColor: AppColors.app_base_theme_color.withValues(alpha: 0.5), // 可选：选中文本背景色
      selectionHandleColor: AppColors.app_base_theme_color.withValues(alpha: 0.5), // 可选：拖拽手柄颜色
    ),
    /*dialogTheme: DialogThemeData(
        titleTextStyle:  TextStyle(fontSize: 34.sp,color: AppColors.dialogTextColor,fontWeight: FontWeight.bold),
        contentTextStyle: TextStyle(fontSize: 28.sp,color: AppColors.dialogTextColor)

    ),*/
  );


  static final TextStyle linkStyle = TextStyle(
      color: AppColors.app_base_theme_color,
      fontSize: 14.sp
  );

  static final TextStyle linkStyle_BIG = TextStyle(
      color: AppColors.app_base_theme_color,
      fontSize: 16.sp
  );


  static final TextStyle normal = TextStyle(
      color: Colors.black,
      fontSize: 14.sp
  );

  static final TextStyle normal_bold =  TextStyle(
      color: Colors.black,
      fontSize: 14.sp,
      fontWeight: FontWeight.w600
  );

  static final TextStyle normal_bold_small =  TextStyle(
      color: Colors.black,
      fontSize: 12.sp,
      fontWeight: FontWeight.w600
  );

  // 8A8A8E
  static final TextStyle normal_gray = TextStyle(
      color: AppColors.second_title_color,
      fontSize: 14.sp
  );

  static final TextStyle normal_red = TextStyle(
      color: Colors.red,
      fontSize: 14.sp
  );

  static final TextStyle Title_H3 = TextStyle(
      color: AppColors.title_h3_theme_color,
      fontSize: 30.sp,
      fontWeight: FontWeight.w900
  );

  static final TextStyle Title_H4 = TextStyle(
      color: AppColors.title_h3_theme_color,
      fontSize: 26.sp,
      fontWeight: FontWeight.w900
  );


  static final TextStyle PAGE_TITLE = TextStyle(
      color: AppColors.big_title_color,
      fontSize: 16.sp,
      fontWeight: FontWeight.w900
  );

  static final TextStyle BIG_TITLE = TextStyle(
      color: AppColors.big_title_color,
      fontSize: 24.sp,
      fontWeight: FontWeight.w900
  );

  static final TextStyle SECOND_TITLE = TextStyle(
      color: AppColors.second_title_color,
      fontSize: 14.sp
  );


  static final TextStyle SECOND_CONTENT = TextStyle(
      color: AppColors.big_title_color,
      fontSize: 14.sp
  );

  static final TextStyle HINT_TEXT_STYLE = TextStyle(
      color: AppColors.hint_text_color.withValues(alpha: 0.4),
      fontSize: 16.sp
  );

  static final TextStyle HINT_TEXT_STYLE_medium = TextStyle(
      color: AppColors.hint_text_color.withValues(alpha: 0.4),
      fontSize: 14.sp
  );

  static final TextStyle HINT_TEXT_STYLE_small = TextStyle(
      color: AppColors.hint_text_color.withValues(alpha: 0.4),
      fontSize: 12.sp
  );


  static final TextStyle LABEL_TEXT_STYLE = TextStyle(
      color: AppColors.hint_text_color.withValues(alpha: 0.4),
      fontSize: 16.sp
  );


  static final TextStyle LABEL_TEXT_STYLE_12 = TextStyle(
      color: AppColors.hint_text_color.withValues(alpha: 0.4),
      fontSize: 12.sp
  );

  static final TextStyle BUTTON_TEXT_STYLE = TextStyle(
      color: AppColors.big_title_color,
      fontSize: 16.sp
  );

  static final TextStyle RECORD_SCRIPT_TEXT_STYLE = TextStyle(
      color: AppColors.big_title_color,
      fontSize: 16.sp,
      fontWeight: FontWeight.w600
  );

  static final TextStyle listener_bottom_label_value =  TextStyle(
      color: AppColors.listener_bottom_label,
      fontSize: 12.sp,
      fontWeight: FontWeight.w600
  );

}